<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>五指山污水处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/logincss/layout.css" media="all">
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }
    .layui-form-label{
        width: 85px;
        position: relative;
        margin-left: -5px;
    }

</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="component-form-element" id="form" method="post" enctype="multipart/form-data">
                <input type="hidden" name="tid" id="tid">
                <div class="layui-tab-content" style="height: auto">

                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">乡镇</label>
                                    <div class="layui-input-block">
                                        <select  id="xz-select" name="xz" lay-filter="xz-select"
                                                 class="layui-input">
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">村委会</label>
                                    <div class="layui-input-block">
                                        <select  name="cwh" lay-filter="cwh-select" id="cwh-select"
                                                 class="layui-input">
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">自然村</label>
                                    <div class="layui-input-block">
                                        <select  name="zrc" lay-filter="zrc-select" id="zrc-select"
                                                 class="layui-input">
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>



                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备型号</label>
                                    <div class="layui-input-block">
                                        <input type="text" id="sbxh" name="sbxh" lay-verify="sbxh"
                                               autocomplete="off" placeholder="请输入设备型号"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">巡查日期</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="xcrqString" lay-verify="xcrqString" id="xcrqString"
                                               autocomplete="off" placeholder="请输入巡查日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">工作人员</label>
                                    <div class="layui-input-block">
                                        <div  name="gzrySel" lay-verify="gzry" id="gzrySel"></div>
                                        <input name="gzry" id="gzry" type="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    设备运行情况
                    <hr>
                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">供电</label>
                                    <div class="layui-input-block">
                                        <div   id="gdSel" name="gdSel" lay-verify="gd">
                                        </div>
                                        <input id="gd" name="gd" type="hidden" value="">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">提升泵</label>
                                    <div class="layui-input-block">
                                        <div   name="tsbSel" lay-verify="tsb" id="tsbSel" >
                                        </div>
                                        <input name="tsb" id="tsb" type="hidden">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">产水泵</label>
                                    <div class="layui-input-block">
                                        <div   name="csbSel" lay-verify="csb" id="csbSel" >

                                        </div>
                                        <input name="csb" id="csb" type="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">机油</label>
                                    <div class="layui-input-block">
                                        <div  name="jySel" lay-verify="jy" id="jySel">
                                        </div>
                                        <input name="jy" id="jy" type="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">皮带</label>
                                    <div class="layui-input-block">
                                        <div  id="pdSel" name="pdSel" lay-verify="pd" >
                                        </div>
                                        <input name="pd" id="pd" type="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">显示屏</label>
                                    <div class="layui-input-block">
                                        <div   name="xspSel" lay-verify="xsp" id="xspSel" >
                                        </div>
                                        <input name="xsp" id="xsp" type="hidden">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">连接管</label>
                                    <div class="layui-input-block">
                                        <div  name="ljgSel" lay-verify="ljg" id="ljgSel">
                                        </div>
                                        <input name="ljg" id="ljg" type="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">反洗泵</label>
                                    <div class="layui-input-block">
                                        <div  name="fxbSel" lay-verify="fxb" id="fxbSel" >
                                        </div>
                                        <input name="fxb" id="fxb" type="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg12">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">工作内容</label>
                                    <div class="layui-input-block">
                                        <textarea  type="text" id="gznr" name="gznr" lay-verify="gznr" autocomplete="off" placeholder="请输入工作内容" class="layui-input"></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="layui-row">
                        <div class="layui-col-lg6">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备维修日期</label>
                                    <div class="layui-input-block">
                                        <input type="text" id="sbwxrqString" name="sbwxrqString" lay-verify="sbwxrqString"
                                               autocomplete="off" placeholder="请输入设备维修日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg6">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备维修人员</label>
                                    <div class="layui-input-block">
                                        <div  id="sbwxrySel" name="sbwxrySel" lay-verify="sbwxry">
                                            <input name="sbwxry" id="sbwxry" type="hidden">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-row">
                            <div class="layui-col-lg12">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">故障描述</label>
                                        <div class="layui-input-block">
                                            <textarea  type="text" id="gzms" name="gzms" lay-verify="gzms" autocomplete="off" placeholder="请输入故障描述" class="layui-input"></textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="layui-row">
                            <div class="layui-col-lg12">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">修复情况</label>
                                        <div class="layui-input-block">
                                            <textarea  type="text" id="xfqk" name="xfqk" lay-verify="xfqk" autocomplete="off" placeholder="请输入修复情况" class="layui-input"></textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="layui-row">
                            <div class="layui-col-lg3">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">管网巡查情况</label>
                                        <div class="layui-input-block">
                                            <input type="text" id="gwxcqk" name="gwxcqk" lay-verify="gwxcqk"
                                                   autocomplete="off" placeholder="请输入管网巡查情况"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-col-lg9">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">备注</label>
                                        <div class="layui-input-block">
                                            <textarea style="resize: none"  type="text" id="bz" name="bz" lay-verify="bz" autocomplete="off" placeholder="请输入备注" class="layui-input"></textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-lg6" id="image">
                            <div class="layui-col-xs12">
                                <label class="layui-form-label">相关图片</label>
                                <span class="layui-btn layui-btn-primary">选择图片
                                          <input type="file" id="uploadImg" class="uploadImg" name="uploadImage" multiple="multiple">
                                        </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-footer" style="left: 0;padding: 0px;">
                        <button class="layui-btn" lay-submit lay-filter="*" id="pushButton">确认修改</button>
                    </div>
                </div>
            </form>

        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    function child(tid){
        layui.use(['form', 'laydate', 'layer','xmSelect'], function () {
            var $ = layui.$
                , form = layui.form
                , laydate = layui.laydate
                , layer = layui.layer
                , xmSelect=layui.xmSelect;

            var fromxData;
            //自定义验证规则
            form.verify({
                xz: function (value, item) {
                    if (value === null || value === "") {
                        return '请选择乡镇';
                    }
                },
                cwh: function (value, item) {
                    if (value === null || value === "") {
                        return '请选择村委会';
                    }
                },
                zrc: function (value, item) {
                    if (value === null || value === "") {
                        return '请选择自然村';
                    }
                },
            });

            laydate.render({
                elem: '#sbwxrqString' //指定元素
            });
            laydate.render({
                elem: '#xcrqString' //指定元素
            });
            var gdSel = xmSelect.render({
                el: '#gdSel',
                language: 'zn',
                on:function (data){
                    var arr1 = data.arr;
                    var str = ''
                    for (var i =0;i<arr1.length;i++){
                        str = str+arr1[i].value+','
                    }
                    document.getElementById("gd").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '异常', value: '异常'},
                    {name: '停电', value: '停电'},
                    {name: '跳闸', value: '跳闸'},
                ]

            })

            var tsbSel = xmSelect.render({
                el: '#tsbSel',
                language: 'zn',
                on:function (data){
                    var arr2 = data.arr;
                    var str = ''
                    for (var i =0;i<arr2.length;i++){
                        str = str+arr2[i].value+','
                    }
                    document.getElementById("tsb").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '异常', value: '异常'},
                    {name: '堵塞', value: '堵塞'},
                    {name: '疏通', value: '疏通'},
                    {name: '更换', value: '更换'},
                ]
            })

            var fxbSel = xmSelect.render({
                el: '#fxbSel',
                language: 'zn',
                on:function (data){
                    var arr3 = data.arr;
                    var str = ''
                    for (var i =0;i<arr3.length;i++){
                        str = str+arr3[i].value+','
                    }
                    document.getElementById("fxb").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '异常', value: '异常'},
                    {name: '故障', value: '故障'},
                    {name: '修复', value: '修复'},
                    {name: '更换', value: '更换'},
                ]

            })
            var csbSel = xmSelect.render({
                el: '#csbSel',
                language: 'zn',
                on:function (data){
                    var arr4 = data.arr;
                    var str = ''
                    for (var i =0;i<arr4.length;i++){
                        str = str+arr4[i].value+','
                    }
                    document.getElementById("csb").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '异常', value: '异常'},
                    {name: '故障', value: '故障'},
                    {name: '修复', value: '修复'},
                    {name: '更换', value: '更换'},
                ]

            })

            var jySel = xmSelect.render({
                el: '#jySel',
                language: 'zn',
                on:function (data){
                    var arr5 = data.arr;
                    var str = ''
                    for (var i =0;i<arr5.length;i++){
                        str = str+arr5[i].value+','
                    }
                    document.getElementById("jy").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '异常', value: '异常'},
                    {name: '堵塞', value: '堵塞'},
                    {name: '疏通', value: '疏通'},
                    {name: '更换', value: '更换'},
                ]

            })

            var pdSel = xmSelect.render({
                el: '#pdSel',
                language: 'zn',
                on:function (data){
                    var arr6 = data.arr;
                    var str = ''
                    for (var i =0;i<arr6.length;i++){
                        str = str+arr6[i].value+','
                    }
                    document.getElementById("pd").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '破损', value: '破损'},
                    {name: '更换', value: '更换'},
                ]

            })
            var xspSel = xmSelect.render({
                el: '#xspSel',
                language: 'zn',
                on:function (data){
                    var arr7 = data.arr;
                    var str = ''
                    for (var i =0;i<arr7.length;i++){
                        str = str+arr7[i].value+','
                    }
                    document.getElementById("xsp").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '黑屏', value: '黑屏'},
                    {name: '堵塞', value: '堵塞'},
                    {name: '疏通', value: '疏通'},
                    {name: '更换', value: '更换'},
                ]

            })

            var ljgSel = xmSelect.render({
                el: '#ljgSel',
                language: 'zn',
                on:function (data){
                    var arr8 = data.arr;
                    var str = ''
                    for (var i =0;i<arr8.length;i++){
                        str = str+arr8[i].value+','
                    }
                    document.getElementById("ljg").value = str
                },
                data: [
                    {name: '正常', value: "正常"},
                    {name: '堵塞', value: '堵塞'},
                    {name: '断裂', value: '断裂'},
                    {name: '疏通', value: '疏通'},
                    {name: '修复', value: '修复'},
                ]

            })



            $.ajax({
                type: "get",
                url: "<%=request.getContextPath()%>/rest/base/getXzglSelect",
                dataType: "json",
                async: false,
                data:{
                    xzzdId:-1
                },
                success: function (msg) {
                    document.getElementById("xz-select").options.length = 0;
                    var content = '<option value="">请选择乡镇</option>';
                    var  xzSelect = $("#xz-select");
                    for (var i = 0;i<msg.xzzdList.length;i++){
                        content+='<option value="' + msg.xzzdList[i].id + '">' + msg.xzzdList[i].title + '</option>';;
                    }
                    xzSelect.append(content)
                    form.render()
                }

            })


            //监听乡镇select
            form.on('select(xz-select)',function (data){
                jianTingxz(data.value)
            })

            function  jianTingxz(value){
                //给村委会赋值
                var cwhselect = $("#cwh-select");
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/base/getXzglSelect",
                    dataType: "json",
                    async: false,
                    data:{
                        'xzzdId':value,
                    },
                    success: function (msg) {
                        document.getElementById("cwh-select").options.length = 0;
                        var content = '<option value="">请选择村委会</option>';
                        var  cwhSelect = $("#cwh-select");
                        for (var i = 0;i<msg.xzzdList.length;i++){
                            content+='<option value="' + msg.xzzdList[i].id + '">' + msg.xzzdList[i].title + '</option>';;
                        }
                        cwhSelect.append(content)
                        form.render();
                    }
                })

            }



            //监听村委会select
            form.on('select(cwh-select)',function (data){
             jianTingcwh(data.value)
            })


            function jianTingcwh(value){
                //给自然村赋值
                var cwhselect = $("#zrc-select");
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/base/getZrcs",
                    dataType: "json",
                    async: false,
                    data:{
                        'xzzdId':value,
                    },
                    success: function (msg) {
                        var  content = ""
                        document.getElementById("zrc-select").options.length = 0;
                        if(msg.xzzdList.length>0){
                            content = '<option value="">请选择自然村</option>';
                        }else {
                            content = '<option value="">没有可选择的自然村</option>';
                        }
                        var  zrcSelect = $("#zrc-select");
                        for (var i = 0;i<msg.xzzdList.length;i++){
                            content+='<option value="' + msg.xzzdList[i].id + '">' + msg.xzzdList[i].title + '</option>';;
                        }
                        zrcSelect.append(content)
                        form.render();
                    }
                })
            }

            $('#uploadImg').bind("change",function(){
                var pNode = this.parentNode.parentNode;
                var fileData = this.files;
                var pettern = /^image/;
                if(fileData.length > 10 ){
                    layer.msg("最多只能上传五张图片", {icon: 5, anim: 6});
                    this.value = null;
                }else if(fileData.length > 0){
                    for(var j = pNode.children.length - 1; j > 0; j--){
                        if(pNode.children[j].className === "imglist"){
                            pNode.removeChild(pNode.children[j]);
                        }
                    }
                    for(var i = 0; i < fileData.length; i++){
                        var file = fileData[i];
                        if(pettern.test(file.type)){
                            if(file.size >=2097152){
                                layer.msg("图片"+file.name+"过大，请选择小于2MB的图片", {icon: 5, anim: 6});
                                this.value = null;
                            }else{
                                var reads = new FileReader();
                                reads.readAsDataURL(file);
                                reads.onload = function(e) {
                                    $("<div class='imglist'>\n" +
                                        "<img src='"+ this.result +"' id='img3' class='img3'/>\n" +
                                        "<div class='prompt3'></div>"+
                                        "</div>").insertAfter(pNode.children[0]);
                                };
                            }
                        }else {
                            layer.msg(file.name+"不是图片，请上传正确的图片文件", {icon: 5, anim: 6});
                            this.value = null;
                        }
                    }
                }else {
                    layer.msg("未选择任何文件", {icon: 5, anim: 6});
                }
            });


            $.ajax({
                type: "get",
                url: "<%=request.getContextPath()%>/rest/base/getCircuitByTid",
                dataType: "json",
                async: false,
                data:"tid="+tid,
                success: function (msg) {
                    var oneMsg = msg
                    if(msg.gd!= null && msg.gd != ""){
                        gdSel.setValue(getSelectArray(msg.gd))
                    }
                    if(msg.tsb!= null && msg.tsb != ""){
                        tsbSel.setValue(getSelectArray(msg.tsb))
                    }
                    if(msg.csb!= null && msg.csb != ""){
                        csbSel.setValue(getSelectArray(msg.csb))
                    }
                    if(msg.jy!= null && msg.jy != ""){
                        jySel.setValue(getSelectArray(msg.jy))
                    }

                    if(msg.pd!= null && msg.pd != ""){
                        pdSel.setValue(getSelectArray(msg.pd))
                    }

                    if(msg.xsp!= null && msg.xsp != ""){
                        xspSel.setValue(getSelectArray(msg.xsp))
                    }
                    if(msg.ljg!= null && msg.ljg != ""){
                        ljgSel.setValue(getSelectArray(msg.ljg))
                    }
                    if(msg.fxb!= null && msg.fxb != ""){
                        fxbSel.setValue(getSelectArray(msg.fxb))
                    }

                    $.ajax({
                        type: "get",
                        url: "<%=request.getContextPath()%>/rest/base/getUserList",
                        dataType: "json",
                        async: true,
                        success:function (msg) {
                            var selectData =[]
                            for (var i =0;i<msg.length;i++){
                                var item = msg[i]
                                var data = {
                                    name: item.username,
                                    value:item.username
                                }
                                selectData.push(data)
                            }
                            var sbwxrySel = xmSelect.render({
                                el: '#sbwxrySel',
                                language: 'zn',
                                on:function (data){
                                    var arr9 = data.arr;
                                    var str = ''
                                    for (var i =0;i<arr9.length;i++){
                                        str = str+arr9[i].value+','
                                    }
                                    document.getElementById("sbwxry").value = str
                                },
                                data:selectData

                            })
                            if(oneMsg.sbwxry!= null && oneMsg.sbwxry != ""){
                                sbwxrySel.setValue(getSelectArray(oneMsg.sbwxry))
                            }
                            var gzrySel = xmSelect.render({
                                el: '#gzrySel',
                                language: 'zn',
                                on:function (data){
                                    var arr0 = data.arr;
                                    var str = ''
                                    for (var i =0;i<arr0.length;i++){
                                        str = str+arr0[i].value+','
                                    }
                                    document.getElementById("gzry").value = str
                                },
                                data:selectData

                            })
                            if(oneMsg.gzry!= null && oneMsg.gzry != ""){
                                gzrySel.setValue(getSelectArray(oneMsg.gzry))
                            }
                        }
                    })
                    jianTingxz(msg.xz)
                    jianTingcwh(msg.cwh)
                    form.render()
                    var pNode = document.getElementById("image");
                    var image = msg.imgurl;
                    console.log(image)
                    if(image != null && image !== ""){
                        var imagepath = image.split(",");
                        if(imagepath.length > 0){
                            for(var i = 0; i < imagepath.length; i++){
                                $("<div class='imglist'>\n" +
                                    "<img src='"+ imagepath[i] +"' id='img3' class='img3' alt=''/>\n" +
                                    "<div class='prompt3'></div>"+
                                    "</div>").insertAfter(pNode.children[0]);
                            }
                        }
                    }
                    form.val("component-form-element", msg)

                }
            })

          function getSelectArray(str) {
              str = str.substring(0, str.length - 1);
             return  strArray = str.split(",")
          }



            //第一种方法添加用户
            form.on('submit(*)', function (data) {
                var field = data.field//当前容器的全部表单字段，名值对形式：{name: value}
                var formData = new FormData($("#form")[0]);
                var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.6});
                $("#pushButton").addClass("layui-btn layui-btn-disabled").prop("disabled", true);
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/base/updateCircuit",
                    data: formData,
                    processData: false,
                    cache: false,      			//上传文件不需要缓存
                    contentType: false,
                    dataType: "json",
                    async: false,
                    success: function (obj) {
                        setTimeout(function () {
                            layer.close(index);
                            if (obj === true) {
                                layer.msg('修改成功');
                            } else {
                                layer.msg(obj.errorMsg);
                            }
                        }, 2000);
                        setTimeout(function () {
                            var indexs = parent.layer.getFrameIndex(window.name);//获取当前弹出层的层级
                            parent.layer.close(indexs);//关闭弹出层
//                        window.parent.location.reload();//刷新父页面
                        }, 4000);
                    }
                })
                return false;
            });

        });
    }
</script>
</body>
</html>